package com.wwl.base.common.excel;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/2/8 11:20
 * @description:
 */
public class DataTable {

    /**
     * 表格名称
     */
    private String tableName;

    private List<DataColumn> columns;

    public DataTable(String tableName) {
        this.tableName = tableName;
        this.columns = new ArrayList<DataColumn>();
    }

    public DataTable(String tableName, List<DataColumn> columns) {
        this(tableName);
        this.columns.addAll(columns);
    }


    public DataTable addColumn(DataColumn column) {
        this.columns.add(column);
        return this;
    }

    public DataTable addColumn(String name, String displayName) {
        DataColumn column = new DataColumn(name, displayName);
        this.addColumn(column);
        return this;
    }

    public DataTable addColumns(List<DataColumn> columns) {
        this.columns.addAll(columns);
        return this;
    }

    public String getTableName() {
        return tableName;
    }

    public List<DataColumn> getColumns() {
        return this.columns;
    }
}
